home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / share / dos / graficos / plydat14.arj / DEF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-31  |  2.1 KB  |  67 lines

  1. /*
  2.  * def.h contains some useful definitions for "C" programs.
  3.  *
  4.  * Version:  2.2 (11/17/87)
  5.  * Author:  Eric Haines, 3D/Eye, Inc.
  6.  */
  7.  
  8. #define EPSILON               5.0e-6
  9.  
  10. #ifndef FALSE
  11. #define      FALSE   0
  12. #endif
  13.  
  14. #ifndef NULL
  15. #define      NULL    0
  16. #endif
  17.  
  18. #ifndef TRUE
  19. #define      TRUE    1
  20. #endif
  21.  
  22. #ifndef PI
  23. #define PI 3.141592653589793
  24. #endif
  25.  
  26.  
  27. typedef double MATRIX[4][4] ;  /* row major form */
  28.  
  29. typedef struct {
  30.      double  x ;
  31.      double  y ;
  32.      double  z ;
  33.      double  w ;
  34. } COORD4, *COORD4_P ;
  35.  
  36.  
  37. #define ABSOLUTE(A)  ( (A) < 0 ? -(A) : (A) )
  38. #define FRACTION(A)  ( (A) - (long)(A) )
  39. #define MAX(A,B)     ( (A) > (B) ? (A) : (B) )
  40. #define MAX3(A,B,C)  ( MAX( MAX( A,B ), C ) )
  41. #define MIN(A,B)     ( (A) < (B) ? (A) : (B) )
  42. #define MIN3(A,B,C)  ( MIN( MIN( A,B ), C ) )
  43. #define SQR(A)       ( (A) * (A) )
  44.  
  45. #define ADD2_COORD(r,a)   { (r).x += (a).x; (r).y += (a).y;\
  46.                             (r).z += (a).z; }
  47. #define ADD3_COORD(r,a,b) { (r).x = (a).x + (b).x;\
  48.                             (r).y = (a).y + (b).y;\
  49.                             (r).z = (a).z + (b).z; }
  50. #define COPY_COORD(r,a)   { (r).x = (a).x; (r).y = (a).y; (r).z = (a).z;}
  51. #define COPY_COORD4(r,a)  { (r).x = (a).x; (r).y = (a).y; (r).z = (a).z;\
  52.                             (r).w = (a).w; }
  53. #define CROSS(r,a,b)      { (r).x = (a).y * (b).z - (a).z * (b).y;\
  54.                             (r).y = (a).z * (b).x - (a).x * (b).z;\
  55.                             (r).z = (a).x * (b).y - (a).y * (b).x; }
  56. #define DOT_PRODUCT(a,b)  ( (a).x * (b).x +\
  57.                             (a).y * (b).y +\
  58.                             (a).z * (b).z )
  59. #define SET_COORD(r,a,b,c) { (r).x = (a); (r).y = (b); (r).z = (c); }
  60. #define SET_COORD4(r,a,b,c,d) { (r).x = (a); (r).y = (b); (r).z = (c);\
  61.                                  (r).w = (d); }
  62. #define SUB2_COORD(r,a)         { (r).x -= (a).x; (r).y -= (a).y;\
  63.                                 (r).z -= (a).z; }
  64. #define SUB3_COORD(r,a,b)    { (r).x = (a).x - (b).x;\
  65.                                  (r).y = (a).y - (b).y;\
  66.                                  (r).z = (a).z - (b).z; }
  67.